home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7254 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  70 lines

  1. Newsgroups: comp.lang.c++
  2. Path: leeds.ac.uk!news
  3. From: vct@scs.leeds.ac.uk (V Times)
  4. Subject: Weird Syntax error (Undeclared identifier)
  5. Message-ID: <1996Feb22.114420.25783@leeds.ac.uk>
  6. NNTP-Posting-Host: csgi48.leeds.ac.uk
  7. Organization: The University of Leeds, School of Computer Studies
  8. Date: Thu, 22 Feb 1996 11:44:20 +0000 (GMT)
  9.  
  10. Hi !
  11.  
  12. I am having a strange compiling error. I have defined a class BUT I can not create an object of that
  13. class. It is giving me an error (please refer to the code below).
  14.  
  15. Can someone tell me the cause of the error?
  16.  
  17. Thanks,
  18.  
  19. Valeria
  20.  
  21. ps Please send your reply directly to me (I seldom read the newsgroup).
  22.  
  23. >==============================================================
  24. >
  25. >       case POLYLINE:
  26. >             {
  27. >line  189     Polyline pl;
  28. >             for (long int i = 0;i <= nSegs; i++)
  29. >               {
  30. >                  ar >> x >> y;
  31. >line  193          pl.AddNew(x,y);
  32. >                  TRACE1 ("Ok. X_Coordinate read: %d  \n",x);
  33. >                  TRACE1 ("Ok. Y_Coordinate read: %d  \n",y);
  34. >               }
  35. >              }
  36. >           break;
  37. >
  38. >C:\tmp\vct\Operators\Operadoc.cpp(189) : error C2146: syntax error : missing
  39. >';' before identifier 'pl'
  40. >C:\tmp\vct\Operators\Operadoc.cpp(189) : error C2065: 'pl' : undeclared
  41. >identifier
  42. >C:\tmp\vct\Operators\Operadoc.cpp(193) : error C2228: left of '.AddNew' must
  43. >have class/struct/union type
  44. >
  45. >
  46. >/*  Class Polyline is defined as follows. */
  47. >
  48. >
  49. >class Polyline : public SpatialObject
  50. >{
  51. >/*
  52. >   Draws a polyline composed by a number n
  53. >   of segments contained in the array segs.
  54. >*/
  55. >
  56. > protected:
  57. >
  58. > public:
  59. >//  Polyline () {}
  60. >
  61. >  /* > Draw object to display */
  62. >  void Display (CDC*) ;
  63. >
  64. >  /* Show contents of object */
  65. >  virtual void Show () ;
  66. >
  67. > /* Destructor function */
  68. > ~Polyline() {TRACE0 ("~Polyline ()\n");}
  69. >} ;
  70.